package org.example.dubbo.nativeimage.provider;

import org.apache.dubbo.config.annotation.DubboService;
import org.apache.dubbo.rpc.RpcContext;
import org.example.dubbo.nativeimage.DemoService;
import org.example.dubbo.nativeimage.HelloRequest;
import org.example.dubbo.nativeimage.HelloResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@DubboService
public class DemoServiceImpl implements DemoService {
    private static final Logger logger = LoggerFactory.getLogger(DemoServiceImpl.class);
    @Override
    public HelloResponse sayHello(HelloRequest request) {
        logger.info("Hello " + request.getName() + ", request from consumer: " + RpcContext.getContext().getRemoteAddress());
        return new HelloResponse(request.getName());
    }
}